package edu.java.homework.hw10.tests;

/* 5.15
 Kakvi cifri i v kakva posledovatelnost shte se otpechatat
 */

public class MyClass1 {
    public static void main(String[] args){
	int k = 0;
	try {
	    int i = 5 / k;
	} catch (ArithmeticException e) {
	    System.out.println("1");
	} catch (RuntimeException e) {
	    System.out.println("2");
	    return;
	} 
	catch (Exception e) {
	    System.out.println("3");
	}
	finally {
	    System.out.println("4");
	}
	System.out.println("5");
    }
}

// Answer: 1 4 5
// Dividing by zero is RuntimeException, and more precisely it is an Arithmetic
// Exception. So when when the exception is thrown
// on 9th row, then we come in the first catch-statement which can hadle this
// exception. It is the first catch-statement. After execution of the
// body of this statement we jump over the other catch-statements and come in
// the finally-block. After that we continue with the next statement
// after finally block.